package com.ruoyi.system.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.Vip;
import com.ruoyi.system.mapper.VipMapper;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: 风离
 * @Date: 2022/06/26/4:18
 * @Description:
 */
@RestController
@RequestMapping("/system/vip")
public class VipController {
    @Resource
    private VipMapper vipMapper;

    //获取会员列表
    @RequestMapping("/list")
    public AjaxResult list(){
        return AjaxResult.success(vipMapper.selectList(null));
    }
    //编辑会员列表
    @RequestMapping("/edit")
    public AjaxResult edit(@RequestBody Vip vip){
        return AjaxResult.success(vipMapper.edit(vip));
    }
    //新增会员列表
    @RequestMapping("/add")
    public AjaxResult add(@RequestBody Vip vip){
        return AjaxResult.success(vipMapper.insert(vip));
    }
    //删除会员列表
    @RequestMapping("/delete")
    public AjaxResult delete(@RequestParam("ids") Integer[] ids){
        return AjaxResult.success(vipMapper.deleteById(ids));
    }
}
